package com.ocom.company.controller;

import com.ocom.common.constant.CompanyServiceUrl;
import com.ocom.common.entity.company.EntityImportLog;
import com.ocom.common.resp.Result;
import com.ocom.common.utils.ResultUtil;
import com.ocom.company.service.ImportLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: TODO
 * @Author: 朱晖
 * @Date: 2022年10月8日10:21:06
 **/
@RestController
public class ImportLogController {

	@Autowired
	ImportLogService importLogService;

	@PostMapping(CompanyServiceUrl.URL_importLog)
	public Result importLog(@RequestBody EntityImportLog entityImportLog){
		importLogService.saveImprt(entityImportLog.getComId(),entityImportLog);
		return ResultUtil.success();
	}


	@PostMapping(CompanyServiceUrl.URL_importList)
	public Result importList(Long companyId,Integer page,Integer Size){
		Result result = importLogService.getLogs(companyId, page, Size);
		if(null==result.getData()){
			return  ResultUtil.success();
		}
		return result;
	}
}
